package jianshengaunli;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DatabaseUtils {

		 
		 public static Connection getConnection() {
		        Connection connection = null;
		        try {
		            Class.forName("com.mysql.cj.jdbc.Driver");
		            connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/dazuoye?useSSL=false&serverTimezone=Asia/Shanghai", "root", "root");
		        } catch (ClassNotFoundException | SQLException e) {
		            e.printStackTrace();
		        }
		        return connection;
		    }

		    public static void closeConnection(Connection connection, Statement statement) {
		        try {
		            if (statement != null) {
		                statement.close();
		            }
		            if (connection != null) {
		                connection.close();
		            }
		        } catch (SQLException e) {
		            e.printStackTrace();
		        }
		    }

			public static void closeResources(Connection connection, PreparedStatement checkStmt, ResultSet rs) {
				// TODO Auto-generated method stub
				
			}
		}
